<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>
  <div id="app"></div>
</body>
<script>
    //创建一个全局组件
    Vue.component("Vbtn",{
        template:"<button>按钮</button>"
    });


    //声明一个头部组件
    var Vheader = {
        data:function () {
            return {}
        },
        methods:{

        },
        template:"<div>我是头部组件</div>"
    };

    //声明一个侧边栏组件
    var Vaside = {
        template:"<div>我是侧边栏组件<Vbtn></Vbtn></div>"
    };

    //声明一个内容组件
    var Vcontent = {
        template:"<div>我是内容组件<Vbtn></Vbtn></div>"
    };


    //声子
    var App = {
        components:{
            Vheader:Vheader,
            Vaside:Vaside,
            Vcontent:Vcontent
        },
        template:"<div>" +
        "<Vheader></Vheader>" +
        "<div>" +
        "<Vaside></Vaside>" +
        "<Vcontent></Vcontent>" +
        "</div>" +
        "</div>"
    };


    new Vue({
        el:"#app",
        data:function () {
            return {}
        },
        //挂子
        components:{
            App:App
        },
        //用子
        template:"<App></App>"
    });


</script>
</html>